package michaelgame.sprite;

import java.awt.Color;
import java.awt.Font;
import java.awt.Graphics2D;
import java.awt.Point;
import framework.Level;
import framework.Sprite;


/**
 * 
 * @author Michael Deng
 * 
 */
public class MoneyTracker extends Sprite {

    private int currentMoney = 0;

    @Override
    public void initialize (Point position, Level l) {
        super.superInitialize(position, null, 0, 0, l);
    }

    @Override
    protected void move () {
        // does not move
    }

    @Override
    protected void action () {
        if (super.getMyLevel().getMyGame().getMyContainer().getLastKeyPressed()
                .equalsIgnoreCase("n")) {
            addMoneyCheat();
        }
    }

    /**
     * method implements cheat
     * method adds money to the current amount of money
     * Note: in increments of 1
     */
    private void addMoneyCheat () {
        if (currentMoney <= 899) {
            currentMoney = currentMoney + 5;
        }
    }

    /**
     */
    public void addMoney () {
        currentMoney = currentMoney + 50;
    }

    /**
     * 
     * @return current amount of money collecteed
     */
    public int getCurrentMoney () {
        return currentMoney;
    }

    /**
     * Displays # of bullets dodged on the screen
     */
    @Override
    public void paint (Graphics2D pen) {
        pen.setColor(Color.WHITE);
        pen.setFont(new Font("Arial", Font.BOLD, 12));
        String output = "MONEY: $" + currentMoney;

        int pageBottom = super.getMyLevel().getMyGame().getMyContainer().getSize().height;
        pen.drawString(output, 10, pageBottom - 50);

    }

}
